function msg = f5d_simple(img, k)
    % F5D_SIMPLE  Extract message using F5.
    
    if k <= 0
        error('k must be above zero.');
    end
    n = 2^k - 1;

    ROWS = size(img,1)/8;
    r = int16(im2vec(img, [8 8])');    
    [M, N] = size(r);
    bin = zeros(1,M*N+k);
    
    % get all LSB
    count = 1;
    usedval = ones(1,n) * -1;
    usedlen = 1;
    for i = 1:M
        for j = 2:N
            if r(i,j) == 0
                continue
            end
            usedval(1, usedlen) = r(i,j);
            usedlen = usedlen + 1;
            if usedlen > n
                v = f5_getValueAsF4(usedval, k, n);
                bin(1, count:count+k-1) = v;
                usedval = ones(1,n) * -1;
                usedlen = 1;
                count = count + k;
            end
        end
    end
    
    count = count - 1;
    
    % output
    msg = binaryToArray(bin, count);
    disp(sprintf('message is: %s',msg));
end
